<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\common\model\hotel\Hotel as HotelModel;
/**
 * 酒店三方接口
 */
class Thirdhotel extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    //获取token
    public function getToken()
    {
        $hotel = new HotelModel();

        $res = $hotel->get_token();
        $this->success('',$res);
    }

    //获取酒店列表
    public function getHotelList()
    {
        $page = input('page',1);
        $page_size = input('page_size',10);
        $hotel = new HotelModel();

        $res = $hotel->get_hotel_list($page,$page_size);

        $this->success('',$res);
    }

    //获取酒店详情
    public function getHotelLInfo()
    {
        $hotel_id = input('hotel_id',0);

        $hotel = new HotelModel();

        $res = $hotel->get_hotel_detail($hotel_id);

        $this->success('',$res);
    }

    //获取房型列表
    public function getRoomTypeList()
    {
        $hotel_id = input('hotel_id',0);
        $page = input('page',1);
        $page_size = input('page_size',10);
        $hotel = new HotelModel();

        $res = $hotel->room_type_list($hotel_id,$page,$page_size);

        $this->success('',$res);
    }

    //获取房型详情
    public function getRoomTypeDetail()
    {
        $hotel_id = input('hotel_id',0);
        $room_type_code = input('room_type_code','');

        $hotel = new HotelModel();

        $res = $hotel->room_type_detail($hotel_id,$room_type_code);

        $this->success('',$res);
    }

    //获取房型价格列表
    public function getRoomPriceList()
    {
        $hotel_id = input('hotel_id',0);
        $room_type_code = input('room_type_code','');
        $checkin_date = input('checkin_date','');
        $checkout_date = input('checkout_date','');
        $hotel = new HotelModel();

        $res = $hotel->room_price_list($hotel_id,$room_type_code,$checkin_date,$checkout_date);

        $this->success('',$res);
    }

    //查询酒店房间可订
    public function getRoomStatus()
    {
        $hotel_id = input('hotel_id',0);
        $room_code_list = input('room_code_list','');
        $start_date = input('start_date','');
        $end_date = input('end_date','');
        $hotel = new HotelModel();

        $res = $hotel->get_room_status($hotel_id,$room_code_list,$start_date,$end_date);

        $this->success('',$res);
    }

    //查询酒店房型可订数量
    public function getRoomTypeStock()
    {
        $hotel_id = input('hotel_id',0);
        $room_type_code_list = input('room_type_code_list','');
        $checkin_date = input('checkin_date','');
        $checkout_date = input('checkout_date','');
        $hotel = new HotelModel();

        $res = $hotel->get_room_type_stock($hotel_id,$room_type_code_list,$checkin_date,$checkout_date);

        $this->success('',$res);
    }

    //查询酒店房型下可订房间
    public function getRoomTypeClearRoomList()
    {
        $hotel_id = input('hotel_id',0);
        $room_type_code = input('room_type_code','');
        $checkin_date = input('checkin_date','');
        $checkout_date = input('checkout_date','');
        $hotel = new HotelModel();

        $res = $hotel->get_room_type_clear_room_list($hotel_id,$room_type_code,$checkin_date,$checkout_date);

        $this->success('',$res);
    }

    //查询酒店单日房态
    public function getRoomOrderState()
    {
        $hotel_id = input('hotel_id',0);
        $date = input('date','');

        $hotel = new HotelModel();

        $res = $hotel->get_room_order_state($hotel_id,$date);

        $this->success('',$res);
    }

}
